/*
	YoghurtGum - 2D Game Engine

	Copyright 2009-2011 Quinten Lansu
	
	Licensed under the Apache License, Version 2.0 (the "License"); you may not 
	use this file except in compliance with the License. You may obtain a copy 
	of the License at 
		
		http://www.apache.org/licenses/LICENSE-2.0 
		
	Unless required by applicable law or agreed to in writing, software 
	distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
	WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
	License for the specific language governing permissions and limitations 
	under the License. 
*/

#ifndef _SPRITEOPENGLES_H_
#define _SPRITEOPENGLES_H_

#include "RenderMethodOpenGLES.h"

#include "YGSprite.h"
#include "SourcesOpenGLES.h"

namespace YoghurtGum
{

	class SpriteOpenGLES : public Sprite
	{
	
	public:
	
		SpriteOpenGLES(TextureOpenGLES* a_Tex);
		~SpriteOpenGLES();

		void Reload();
		bool LoadImageData(til::Image* a_Image, const char* a_Name = "");

		void SetAlphaKey(Color a_AlphaKey);

		bool Draw(float a_X, float a_Y, float a_Depth = 0.f);

		Surface* ToSurface();
	
	private:

		TextureOpenGLES* m_Texture;
		GLfixed m_Vertices[12], m_UVs[12];
		GLuint m_TextureWidth, m_TextureHeight;
		GLfixed m_FixedWidth, m_FixedHeight;
		char m_Name[256];

		bool m_Keying;
		Color m_Key;

		til::Image* m_Image;
	
	}; // class SpriteOpenGLES

}; // namespace YoghurtGum
	
#endif